package com.bkgy.modular.tbdsjruleedit.controller;

import com.alibaba.fastjson.JSON;
import com.bkgy.modular.tbdsjruleedit.entity.JTbDsjRuleEdit;
import com.bkgy.modular.tbdsjruleedit.entity.TbDsjRuleEdit;
import com.bkgy.modular.tbdsjruleedit.service.TbDsjRuleEditService;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
* 简易规则编辑表控制器层
* @author  生成器生成
* @date 2022-07-27 09:54:52
*/
@RestController
@RequestMapping("/tbDsjRuleEdit")
public class TbDsjRuleEditController {

	@Autowired
	private TbDsjRuleEditService tbDsjRuleEditService;
	
	/**
	 * 添加记录
	 * @param data userId 用户id
     * @param data sname 用户姓名
	 * */
	@CrossOrigin
	@RequestMapping(value={"/insert"}, method=RequestMethod.POST)
	@ResponseBody
	public ResultData insertDataTbDsjRuleEdit(@RequestBody String data, @RequestHeader(value="loginToken") String loginToken){
		return tbDsjRuleEditService.insertDataTbDsjRuleEdit(data);
	};
	
	/**
	 * 根据主键删除对象
	 * @param data json字符串
	 * */
	@CrossOrigin
	@RequestMapping(value={"/deleteOne"}, method=RequestMethod.POST)
	@ResponseBody
	public ResultData deleteDataTbDsjRuleEditOne(@RequestBody String data){
		try{
    		JTbDsjRuleEdit jtbDsjRuleEdit = JSON.parseObject(data,JTbDsjRuleEdit.class);
    		return tbDsjRuleEditService.deleteDataTbDsjRuleEditOne(jtbDsjRuleEdit.getCalc_result_variable());
    	}catch(Exception e){
    		e.printStackTrace();
    		return ResultData.ResultDataFaultSelf("访问接口错误，错误信息为" + e.getMessage(), null); 
    	}
	};
	
	/**
     * 根据主键字符串删除多个对象
     * @param data json字符串
     */
    @CrossOrigin
    @RequestMapping(value = {"/deleteMany"}, method = RequestMethod.POST)
    @ResponseBody
    public ResultData deleteDataSysUserMany(@RequestBody String data) {
    	try{
    		JTbDsjRuleEdit jtbDsjRuleEdit = JSON.parseObject(data,JTbDsjRuleEdit.class);
    		return tbDsjRuleEditService.deleteDataTbDsjRuleEditMany(jtbDsjRuleEdit.getStr_indocno());
    	}catch(Exception e){
    		e.printStackTrace();
    		return ResultData.ResultDataFaultSelf("访问接口错误，错误信息为" + e.getMessage(), null); 
    	}
    }
	
	/**
     * 修改记录
     * @param data json字符串
     * @param loginToken 请求头参数字符串对象
     */
    @CrossOrigin
	@RequestMapping(value={"/update"}, method=RequestMethod.POST)
	@ResponseBody
	public ResultData updateDataTbDsjRuleEdit(@RequestBody String data,@RequestHeader(value="loginToken") String loginToken){
		return tbDsjRuleEditService.updateDataTbDsjRuleEdit(data);
	};
	
	/**
     * 分页查看记录
     * @param data json字符串
     */
    @CrossOrigin
    @RequestMapping(value = {"/findByPage"}, method = RequestMethod.POST)
    @ResponseBody
    public ResultData findDataTbDsjRuleEditByPage(@RequestBody String data) {
        return tbDsjRuleEditService.findDataTbDsjRuleEditByPage(data);
    }
    
    /**
     * 根据主键查询单条记录
     * @param data json字符串
     */
    @CrossOrigin
    @RequestMapping(value = {"/findByIndocno"}, method = RequestMethod.POST)
    @ResponseBody
    public ResultData findDataTbDsjRuleEditByIndocno(@RequestBody String data) {
        return tbDsjRuleEditService.findDataTbDsjRuleEditByIndocno(data);
    }
	
	/**
	 * 查看记录
	 * @return list 对象集合返回
	 * */
	@CrossOrigin
	@RequestMapping(value={"/findAll"}, method=RequestMethod.POST)
	public List<TbDsjRuleEdit> findDataTbDsjRuleEdit(){
		return tbDsjRuleEditService.findDataTbDsjRuleEdit();
	};


	/**
	 * 实时调数据获取宝信621
	 * @return list 对象集合返回
	 * */
	@CrossOrigin
	@RequestMapping(value={"/findshi621"}, method=RequestMethod.POST)
	public ResultData findDataTbDsjRuleEditshi621(){
		return tbDsjRuleEditService.findDataTbDsjRuleEditshi621();
	};


    /**
     * 实时调数据获取宝信621
     * @return list 对象集合返回
     * */
    @CrossOrigin
    @RequestMapping(value={"/findshi622"}, method=RequestMethod.POST)
    public ResultData findDataTbDsjRuleEditshi622(){
        return tbDsjRuleEditService.findDataTbDsjRuleEditshi622();
    };


    /**
     * 实时调数据获取宝信621
     * @return list 对象集合返回
     * */
    @CrossOrigin
    @RequestMapping(value={"/findshi642"}, method=RequestMethod.POST)
    public ResultData findDataTbDsjRuleEditshi642(){
        return tbDsjRuleEditService.findDataTbDsjRuleEditshi642();
    };




}
